package com.itheima.controller;

import com.itheima.domain.User;
import com.itheima.service.UserService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.*;

/**
 * @Author 王加鑫
 * @Date 2021/08/18 19:52
 * @Since JDK 1.8
 */
@RestController
@RequestMapping("user")
public class UserController {

    @Reference
    private UserService userService;

    @RequestMapping("sayHello")
    public String sayHello(){
        return userService.sayHello();
    }


    @RequestMapping("login")
    public Boolean login(@RequestBody User user){
        User u = userService.findByUserNameAndPwd(user.getUsername(), user.getPassword());
        System.out.println("u = " + u);
        boolean flag = false;
        if(u != null){
            flag = true;
        }
        return flag;
    }
}
